export default [
    {
        path: '/',
        component: () => import('@/views/Layout.vue'),
        children: [
            {
                path: '/',
                component: () => import('@/views/home/Index.vue'),
            },
            {
                path: '/my',
                component: () => import('@/views/my/Index.vue'),
            }
        ]
    },
    {
        path: '/addarticle',
        component: () => import('@/views/home/addArticle/Index.vue'),
    },
    {
        path: '/publish',
        component: () => import('@/views/my/publish/Index.vue'),
    },
    {
        path: '/detailarticle',
        component: () => import('@/views/home/detailArticle/Index.vue'),
    },
    {
        path: '/updatainfo',
        component: () => import('@/views/my/updataInfo/Index.vue'),
    },
    {
        path: '/tointroduce',
        component: () => import('@/views/my/introduce/Index.vue'),
    },
    {
        path: '/login',
        component: () => import('@/views/login/Index.vue'),
    }
    ,
    {
        path: '/register',
        component: () => import('@/views/register/Index.vue'),
    },

    // 记账页
    {
        path: '/account',
        beforeEnter: (to, from, next) => {
            // reject the navigation
            console.log(to);
            // 获取本地缓存的用户信息
            let userInfo = localStorage.getItem('userInfo');
            // 判断用户是否登录
            if (userInfo) {
                next()
            }
            next('/login')
        },
        component: () => import('@/views/account/MyAccounting.vue'),
    },
    // 统计页
    {
        path: '/statistics',
        beforeEnter: (to, from, next) => {
            // reject the navigation
            console.log(to);
            // 获取本地缓存的用户信息
            let userInfo = localStorage.getItem('userInfo');
            // 判断用户是否登录
            if (userInfo) {
                next()
            }
            next('/login')
        },
        component: () => import('@/views/account/MyStatistics.vue'),
    },
    // 统计页v2
    {
        path: '/statisticsv2',
        beforeEnter: (to, from, next) => {
            // reject the navigation
            console.log(to);
            // 获取本地缓存的用户信息
            let userInfo = localStorage.getItem('userInfo');
            // 判断用户是否登录
            if (userInfo) {
                next()
            }
            next('/login')
        },
        component: () => import('@/views/account/MyStatisticsV2.vue'),
    }
]